<template>
  <el-row class="mx__20 bg-white now-page-height" style="min-width: 1000px">
    <el-col class="current-content-style now-page-height">
      <el-row :gutter="20" type="flex" class="statistics" style="min-width: 100px">
        <el-col :span="6" class="statistics-item">
          <div>
            <h3>{{ countCustomer }}</h3>
            <p>当月新增客户</p>
          </div>
          <i class="el-icon-user"></i>
        </el-col>
        <el-col :span="6" class="statistics-item">
          <div>
            <h3>{{ countWaterMeter }}</h3>
            <p>新安装水表数量</p>
          </div>
          <i class="el-icon-news"></i>
        </el-col>
        <el-col :span="6" class="statistics-item">
          <div>
            <h3>{{ countUNWaterMeter }}</h3>
            <p>未使用水表数量</p>
          </div>
          <i class="el-icon-crop"></i>
        </el-col>
        <el-col :span="6" class="statistics-item">
          <div>
            <h3>{{ countUNMoney }} <small>元</small></h3>
            <p>上月未缴费金额</p>
          </div>
          <i class="el-icon-data-board"></i>
        </el-col>
        <el-col :span="6" class="statistics-item">
          <div>
            <h3>{{ countConsumption }}<small>吨</small></h3>
            <p>上月用水量</p>
          </div>
          <i class="el-icon-copy-document"></i>
        </el-col>
      </el-row>
    </el-col>
  </el-row>
</template>

<script>
import { homeCensusNumber } from '@/config/api'
export default {
  data() {
    return {
      countConsumption: 0,
      countCustomer: 0,
      countUNMoney: 0,
      countUNWaterMeter: 0,
      countWaterMeter: 0
    }
  },
  mounted() {
    this.handler()
  },
  methods: {
    handler() {
      homeCensusNumber().then(res => {
        console.log(res)
        if (res.code === 200) {
          this.countConsumption = res.data.countConsumption
          this.countCustomer = res.data.countCustomer
          this.countUNMoney = res.data.countUNMoney
          this.countUNWaterMeter = res.data.countUNWaterMeter
          this.countWaterMeter = res.data.countWaterMeter
        }
      })
    }
  }
}
</script>

<style scoped lang="less">
small {
  font-size: 16px;
  color: rgb(71, 68, 68);
}
.now-page-height {
  // height:
  min-height: calc(100% - 60px);
}
.statistics {
  flex-wrap: wrap;
  justify-content: start;
}
.statistics-item {
  position: relative;
  box-sizing: border-box;
  flex-basis: calc(33.3333% - 4%);
  min-width: 200px;
  margin: 20px 2%;
  padding: 50px 60px !important;
  background-color: rgba(239, 229, 243, 0.699);
  border-radius: 5px;
  text-align: center;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  &:nth-child(1) {
    background-color: #a38cc6;
  }
  &:nth-child(2) {
    background-color: #ffca5b;
  }
  &:nth-child(3) {
    background-color: #4de5d5;
  }
  &:nth-child(4) {
    background-color: #6ab8f7;
  }
  &:nth-child(5) {
    background-color: #fd3995;
  }
  & > i {
    width: 80px;
    height: 80px;
    border-radius: 40px;
    text-align: center;
    padding-top: 0;
    line-height: 80px;
    border: 0px solid white;
    font-size: 80px;
    color: white;
    opacity: 0.7;
    position: relative;
    /*right取值是父级的左右padding值加10px*/
    right: -70px;
  }
  & p {
    color: #e4e6e7;
    margin: 0;
    font-size: 18px;
    // text-decoration: overline;
    border-top: 1px solid rgba(56, 4, 4, 0.87);
    padding-top: 5px;
    color: #ffffff;
  }
  & h3 {
    margin-top: 0px;
    margin-bottom: 10px;
    color: #ffffff;
    font-size: 30px;
    text-align: left;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-weight: 500;
  }
  @media screen and (max-width: 1200px) {
    & h3 {
      font-size: 32px;
    }
    & p {
      font-size: 14px;
    }
  }
}
</style>
